package main

import (
	"fmt"
	"sync"
	"time"
)



func job(index int) int{

	time.Sleep(time.Millisecond*500)
	return index

}

func main(){

	start:=time.Now()
	num:=5
	wg:=sync.WaitGroup{}
	for i:=0;i<num;i++{
		wg.Add(1)
		go func(param int){
			defer wg.Done()
			fmt.Println(job(param))
		}(i)

	}
	wg.Wait()
	end:=time.Since(start)
	fmt.Println("耗时",end.String())

}


//耗时 510.6339ms
